package cn.ickck.law_paper_final.mapper;

import cn.ickck.law_paper_final.model.entity.Gdb;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: ck
 * @Description:
 * @Date: Create in 14:16 2020/11/28
 */
public interface GdbMapper {
    Integer insert(Gdb gdb);


    @Delete("delete from gdb where `id` = #{id}")
    Integer deleteById(Integer id);


    @Select("select count(*) from gdb")
    int count();


    @Select("select * from gdb limit #{start},#{end}")
    List<Gdb> selectByPage(int start, int end);



    @Select("select * from gdb where name like  CONCAT('%',#{key},'%') or `key` = #{key}")
    List<Gdb> selectByNameOrKey(String key);


    @Delete("delete from gdb where `key` = #{key}")
    Integer deleteByKey(@Param("key") String keyById);
}
